<?php

namespace addons\xshop\library;

class Addon
{

    public $name;

    public function __construct($addon_name)
    {
        $this->name = $addon_name;
    }

    public function config()
    {
        return get_addon_config($this->name);
    }

    /**
     * 获取H5基础路径
     */
    public function getH5BasePath()
    {
        $config = $this->config();
        $url = $config['__DOMAIN__'] . $config['__H5_BASE_PATH__'];
        if ($config['__H5_ROUTE_MODE__'] == 'hash') {
            $url .= '#/';
        }
        return $url;
    }
}